package com.dhcc.wb.articleliushui;

import java.util.List;

import com.dhcc.bussiness.page.PageBean;
import com.dhcc.wb.articleday.ArticleModel;
import com.dhcc.wb.articleliushui.ArticleLiushuiDao;
import com.dhcc.wb.articleliushui.ArticleShowModel;

public class ArticleLiushuiService {
	
	/**
	 * 每日统计
	 * @return
	 */
	public PageBean<ArticleDetailsModel> findArticleServiceByPage(int currentPage, int currentCount,String title,String gzhname) {
		ArticleLiushuiDao dao = new ArticleLiushuiDao();
		PageBean<ArticleDetailsModel> pageBean = new PageBean<ArticleDetailsModel>();
		try {
			pageBean.setCurrentPage(currentPage);
			pageBean.setCurrentCount(currentCount);
			Integer totalCount = dao.queryCount2(title);
			pageBean.setTotalCount(totalCount);
			int totalPage = (int) Math.ceil(1.0*totalCount/currentCount);
			pageBean.setTotalPage(totalPage);
			int startIndex = (currentPage-1)*currentCount;
			List<ArticleDetailsModel> pageList = dao.findArticleService2ByPage(startIndex, currentCount, title,gzhname);
			pageBean.setPageList(pageList);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return pageBean;
	}
	
	
}